import java.util.Arrays;

public class Main {

}

class TestA {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

class TestB {
    public static void main(String[] args) {
        int[] arr = {1, -2, 3, 5, -1};
        int[] arr2 = {1, -2, 3, -8, 5, 1};
        int[] arr3 = {1, -2, 3,-2, 5, 1};


        System.out.println(getMaxSum(arr));
        System.out.println(getMaxSum(arr2));
        System.out.println(getMaxSum(arr3));
    }

    public static int getMaxSum(int[] arr) {
        int max = 0;
        int[] dp = new int[arr.length];
        dp[0] = Math.max(arr[0], 0);
        for (int i = 1; i < dp.length; i++) {
            dp[i] = dp[i - 1] > 0 ? dp[i - 1] + arr[i] : arr[i];
        }

        for (int value : dp) {
            max = Math.max(max, value);
        }
        return max;
    }
}

class TestC {
    private static final int MAX = 20000;

    public static void main(String[] args) {
        int count = 0;

        for (int i = 1; i < MAX; i++) {
            if (isPrimePro(i)) {
                count++;
                System.out.print(i + "\t");
            }

            if (count == 5) {
                count = 0;
                System.out.println();
            }
        }
    }

    public static boolean isPrimePro(int n) {
        if (n < 3) {
            return n > 1;
        }

        int sqrt = (int) Math.sqrt(n);
        for (int i = 2; i <= sqrt; i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }
}
